package com.wsq.annotation;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.wsq.annotation.annotation.MyAnnotationRuntime;
import com.wsq.annotation.demo.AnnotationDemo;
import com.wsq.annotation.demo.HandleAnnotation;
import com.wsq.annotationlib.javapoet.HelloWorld;
//import com.wushengqi.HelloWorld11;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;


public class MainActivity extends AppCompatActivity {
    @HelloWorld(name = "nihao")
    String name;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        name = "haha";
//        HelloWorld11 helloWorld11 = new HelloWorld11();
//        helloWorld11.test(new String[]{"chiji"});

        AnnotationDemo annotationDemo = new AnnotationDemo();
        HandleAnnotation handleAnnotation = new HandleAnnotation();
        try {
            handleAnnotation.handleClassAnnotation(annotationDemo);
            Method method = handleAnnotation.handleMethodAnnotation(annotationDemo);

            method.invoke(annotationDemo, new Object[]{});
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }


    @MyAnnotationRuntime(value = "对方法进行了注解")
    public void methedAnnotation(){

    }

    public void handleMethodAnnotation(){

    }
}
